<!doctype html>
<html lang="zh">

<head>
	<!-- Required meta tags -->
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<meta name="keywords" content="山西农业大学,成绩查询">
	<meta name="description" content="山西农业大学成绩查询">
	<link rel="shortcut icon" href="images/favicon.ico" />
	<link rel="bookmark" href="images/favicon.ico" type="image/x-icon" />
	<!-- Bootstrap CSS -->
	<link rel="stylesheet" href="./bootstrap/css/bootstrap.min.css" crossorigin="anonymous">
	<link rel="stylesheet" href="./css/main.css">
	<title>山西农业大学成绩查询</title>
</head>

<body>
	<div class="container">
		<nav class="navbar navbar-expand-md navbar-light fixed-top bg-white shadow-sm">
			<a class="navbar-brand text-dark" href="current_term.html">山西农业大学成绩查询</a>
			<button class="navbar-toggler collapsed" type="button" data-toggle="collapse" data-target="#navbarCollapse"
				aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
				<span class="navbar-toggler-icon"></span>
			</button>
			<div class="navbar-collapse collapse" id="navbarCollapse">
				<ul class="navbar-nav mr-auto">
					<li class="nav-item active">
						<a class="nav-link" href="current_term.html">本学期成绩</a>
					</li>
					<li class="nav-item">
						<a class="nav-link" href="all_term.html">历年成绩</a>
					</li>
					<li class="nav-item">
						<a class="nav-link" href="fail.html">不及格成绩</a>
					</li>
				</ul>
				<ul class="navbar-nav">
					<li class="nav-item">
						<a class="nav-link" onclick="logout()" href="#">注销</a>
					</li>
				</ul>
			</div>
		</nav>


		<div class="row">
			<div class="col-md-8 offset-md-2" id="show">
				<div class="mt-2 mb-2">正在加载呀......</div>
			</div>
		</div>

	</div>


	<!-- Optional JavaScript -->
	<!-- jQuery first, then Popper.js, then Bootstrap JS -->
	<script src="./js/jquery.min.js" crossorigin="anonymous"></script>
	<script src="./js/popper.min.js" crossorigin="anonymous"></script>
	<script src="./js/bootstrap.min.js" crossorigin="anonymous"></script>
	<script src="./js/grade.js" crossorigin="anonymous"></script>
	<script type="text/javascript">
		$.ajax({
			"url": "grade/current_term.action",
			"method": "POST",
			"dataType": "json",
			"success": function (data) {
				if (data['status'] === -2) {
					alert(data['data']);
					window.location.href = "login.html";
					return;
				}
				if (data['status'] !== 1) {
					alert(data['data']);
					return;
				}
				showGrade(data['data'], $("#show"));
			},
			"error": function () {
				alert("成绩获取失败");
				window.location.href = "login.html";
				//window.location.reload();
			}
		})
	</script>
</body>

</html>